import {catelist} from '../../../request/api'

// 封装一个接口类型
interface StateCate{
    menuList:Array<object>
}

const state = {
    cateList:[]
}

const getters = {
    getCate(state:any){
        return state.cateList
    }
}

const mutations = {
    GET_CATE(state:any,payload:any){
        state.cateList = payload
    }
}

const actions = {
    getCateActions({commit}:any){
     catelist().then(res=>{
        console.log(res);
        commit('GET_CATE',res.list)
     }) 
    }
}

export default {
    state,
    getters,
    mutations,
    actions,
    namespaced:true
}